package com.lefevre.cms.bean.membershipCard;

import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 会员卡订单
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("membership_card_order")
@Entity
@Table(name = "membership_card_order", indexes = {@Index(name = "membership_card_order_1_idx", columnList = "userName,createDate")})
public class MembershipCardOrder implements Serializable {
    private static final long serialVersionUID = -4530223105268525029L;

    /**
     * 订单号
     **/
    @Id
    @TableId(type = IdType.INPUT)
    private Long orderId;

    /**
     * 用户名称
     **/
    @TableField("userName")
    @Column(length = 30)
    private String userName;

    /**
     * 呢称
     **/
    @Transient
    @TableField(exist = false)
    private String nickname;

    /**
     * 头像路径
     **/
    @Transient
    @TableField(exist = false)
    private String avatarPath;

    /**
     * 头像名称
     **/
    @Transient
    @TableField(exist = false)
    private String avatarName;

    /**
     * 订单创建时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    @TableField("createDate")
    private Date createDate = new Date();

    /**
     * 应付款(实际需要支付的费用)
     **/
    @Column(nullable = false, precision = 12, scale = 2)
    @TableField(value = "accountPayable", numericScale = "2")
    private BigDecimal accountPayable = new BigDecimal("0.00");

    /**
     * 应付积分
     **/
    @TableField("accountPoint")
    private Long accountPoint = 0L;

    /**
     * 已支付金额
     **/
    @TableField(value = "paymentAmount", numericScale = "2")
    @Column(nullable = false, precision = 12, scale = 2)
    private BigDecimal paymentAmount = new BigDecimal("0.00");

    /**
     * 已支付积分
     **/
    @TableField("paymentPoint")
    private Long paymentPoint = 0L;

    /**
     * 购买的会员卡用户角色Id
     **/
    @Column(length = 50)
    @TableField("userRoleId")
    private String userRoleId;

    /**
     * 购买的会员卡用户角色名称
     **/
    @Column(length = 192)
    @TableField("roleName")
    private String roleName;

    /**
     * 购买的会员卡Id
     **/
    @TableField("membershipCardId")
    private Long membershipCardId;

    /**
     * 购买的会员卡规格Id
     **/
    @TableField("specificationId")
    private Long specificationId;

    /**
     * 购买的会员卡规格名称
     **/
    @Column(length = 192)
    @TableField("specificationName")
    private String specificationName;

    /**
     * 购买的会员卡数量
     **/
    @TableField("quantity")
    private Integer quantity;

    /**
     * 购买的会员卡有效期时长
     **/
    @TableField("duration")
    private Integer duration;

    /**
     * 购买的会员卡时长单位 10.小时 20.日 30.月 40.年
     **/
    @TableField("`unit`")
    private Integer unit;

    /**
     * 订单版本号
     **/
    @Version
    private Integer version = 0;

}
